package cn.t.dto.device.vo;

import cn.t.constants.CommonConstants;
import cn.t.enums.order.ErrorTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @author l
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QtyVO {

    /**
     * 货道编号
     */
    private Integer no;
    /**
     * 商品编码
     */
    private String skuCode;

    /**
     * 数量(永远是正的)
     */
    private Integer qty;

    /**
     * 异常类型
     */
    private ErrorTypeEnum errorTypeEnum  ;
    /**
     * 重量差(后减前)
     */
    private Double weight;

    public QtyVO(Integer no, Integer qty, Double weight) {
        this.no = no;
        this.qty = qty;
        this.weight = weight;
    }

    public QtyVO(Integer no,ErrorTypeEnum errorTypeEnum) {
        this.no = no;
        this.errorTypeEnum = errorTypeEnum;
    }
    public  boolean isWeightData() {
       return this.weight == null || BigDecimal.valueOf(weight).abs().compareTo(BigDecimal.valueOf(CommonConstants.FIVE)) >= 0;
    }
}
